package login.util;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Properties;

/**
 * @Author Administrator
 * @Date 2020/5/29 10:53
 * Druid数据库连接池技术
 **/
public class JDBCUtils {
    public static DataSource ds;
    static {
        try {
            Properties pro=new Properties();
            pro.load(JDBCUtils.class.getClassLoader().getResourceAsStream("druid.properties"));
            ds= DruidDataSourceFactory.createDataSource(pro);

        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static DataSource getDataSource() {
        return ds;
    }
}
